﻿using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.Domain.Entity;
using IntelligentAgriculture.WebAPI.Application.Command.PurchaseFormModelCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.PurchaseFormModelCommandHandler
{
	/// <summary>
	/// 羊只采购反填
	/// </summary>
	public class DetailPurchaseformmodelCommandHandler : IRequestHandler<DetailPurchaseformmodelCommand, Results<Purchaseformmodel>>
	{
		/// <summary>
		/// 构造函数
		/// </summary>
		private readonly IPurchaseFormModelService _purchaseFormModelService;
		public DetailPurchaseformmodelCommandHandler(IPurchaseFormModelService purchaseFormModelService)
		{
			_purchaseFormModelService = purchaseFormModelService;
		}
		/// <summary>
		/// 羊只采购反填
		/// </summary>
		/// <param name="request"></param>
		/// <param name="cancellationToken"></param>
		/// <returns></returns>
		/// <exception cref="NotImplementedException"></exception>
		public async Task<Results<Purchaseformmodel>> Handle(DetailPurchaseformmodelCommand request, CancellationToken cancellationToken)
		{
			var entity = await _purchaseFormModelService.Purchaseformmodel(request.purchaseFormId);
			return Results<Purchaseformmodel>.DataResult(entity);
		}
	}
}
